package com.niit.drugsmanager.entity.embeddable;

import java.io.Serializable;
import java.util.Objects;

public class NoticeStatusId implements Serializable {
    private Long nid;  // 对应 notice.id
    private Long uid;    // 对应 user.id

    // 必须有无参构造器
    public NoticeStatusId() {}

    public NoticeStatusId(Long noticeId, Long userId) {
        this.nid = noticeId;
        this.uid = userId;
    }

    // Getter & Setter
    public Long getNoticeId() { return nid; }
    public void setNoticeId(Long noticeId) { this.nid = noticeId; }

    public Long getUid() { return uid; }
    public void setUid(Long uid) { this.uid = uid; }

    // 必须重写 equals 和 hashCode
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        NoticeStatusId that = (NoticeStatusId) o;
        return Objects.equals(nid, that.nid) &&
                Objects.equals(uid, that.uid);
    }

    @Override
    public int hashCode() {
        return Objects.hash(nid, uid);
    }
}
